package wangtiles;

public enum Tile {
	tile0(SideValues.moinsDeux,SideValues.moinsUn,SideValues.un,SideValues.deux),
	tile1(SideValues.moinsDeux,SideValues.zero,SideValues.un,SideValues.un),
	tile2(SideValues.moinsUn,SideValues.zero,SideValues.un,SideValues.deux),
	tile3(SideValues.moinsUn,SideValues.moinsDeux,SideValues.zero,SideValues.un),
	tile4(SideValues.zero,SideValues.moinsDeux,SideValues.zero,SideValues.deux),
	tile5(SideValues.zero,SideValues.moinsUn,SideValues.zero,SideValues.un),
	tile6(SideValues.zeroPrime,SideValues.zeroPrime,SideValues.zeroPrime,SideValues.zero),
	tile7(SideValues.zeroPrime,SideValues.zeroPrime,SideValues.deux,SideValues.un),
	tile8(SideValues.zeroPrime,SideValues.unDemi,SideValues.un,SideValues.zero),
	tile9(SideValues.zeroPrime,SideValues.unDemi,SideValues.un,SideValues.zeroPrime),
	tile10(SideValues.unDemi,SideValues.unDemi,SideValues.zeroPrime,SideValues.zero),
	tile11(SideValues.unDemi,SideValues.unDemi,SideValues.deux,SideValues.un),
	tile12(SideValues.unDemi,SideValues.zeroPrime,SideValues.un,SideValues.un);
	
	
	private final SideValues westValue,eastValue,northValue,southValue; 
	
	/**
	 * @param west
	 * @param east
	 * @param north
	 * @param south
	 */
	private Tile(SideValues west, SideValues east, SideValues north,
			SideValues south) {
		this.westValue = west;
		this.eastValue = east;
		this.northValue = north;
		this.southValue = south;
	}

	/**
	 * @return the westValue
	 */
	public SideValues getWestValue() {
		return westValue;
	}

	/**
	 * @return the eastValue
	 */
	public SideValues getEastValue() {
		return eastValue;
	}

	/**
	 * @return the northValue
	 */
	public SideValues getNorthValue() {
		return northValue;
	}

	/**
	 * @return the southValue
	 */
	public SideValues getSouthValue() {
		return southValue;
	}


	public double getWestDbval(){ return this.getWestValue().getValue();}
	public double getEastDbval(){ return this.getEastValue().getValue();}
	public double getNorthDbval(){ return this.getNorthValue().getValue();}
	public double getSouthDbval(){ return this.getSouthValue().getValue();}
	
	public Tile getTile(double w,double e,double n,double s){
		for(Tile c:Tile.values())
			if((c.getWestDbval()==w)&&(c.getEastDbval()==e)&&(c.getNorthDbval()==n)&&(c.getSouthDbval()==s))
				return c; 
		return null;
	}
	
	public static Tile getTile(SideValues w,SideValues e,SideValues n,SideValues s){
		for(Tile c:Tile.values())
			if((c.getWestValue().equals(w))&&(c.getEastValue().equals(e))&&(c.getNorthValue().equals(n))&&(c.getSouthValue().equals(s)))
				return c; 
		return null;
	}

		/*
	public static Tile getTile(SideValues we, SideValues ee, SideValues ne) {
	return tile0; 
	}
	*/

}
